import { DEFAULT_INTERVAL } from '~/utils/constant'

export function useTypeSwitch<T>(list: T[], interval: number = DEFAULT_INTERVAL) {
  const { state, next } = useCycleList(list)
  const { pause, resume } = useIntervalFn(() => {
    next()
  }, interval)
  return {
    type: state,
    next,
    pause,
    resume,
  }
}
